// ActionScript file
import org.flexlancer.Logger.Logger;
import org.flexlancer.events.ItemHideEvent;

public function OnCC():void{
	try{
		this.dgAlerts.addEventListener(ItemHideEvent.HIDE_ITEM,dgAlert_OnHideItem);
		this.dgRecentActivity.addEventListener(ItemHideEvent.HIDE_ITEM,dgRecentActivity_OnHideItem);
	}catch(err:Error){
		Logger.LogE(err);
	}
}

private function dgAlert_OnHideItem(evt:ItemHideEvent):void{
	try{
		var index:Number = evt.DataItem.childIndex();
		if ( index >= 0 ){
			var sclpos:Number = this.dgAlerts.verticalScrollPosition;
			delete this.testDataAlerts.item[index];
			if ( sclpos > this.dgAlerts.maxVerticalScrollPosition ) sclpos = this.dgAlerts.maxVerticalScrollPosition;
			this.dgAlerts.verticalScrollPosition = sclpos;
		}
	}catch(err:Error){
		Logger.LogE(err);
	}
}

private function dgRecentActivity_OnHideItem(evt:ItemHideEvent):void{
	try{
		var index:Number = evt.DataItem.childIndex();
		if ( index >= 0 ){
			var sclpos:Number = this.dgRecentActivity.verticalScrollPosition
			delete this.testDataRecentActivity.item[index];
			if ( sclpos > this.dgRecentActivity.verticalScrollPosition ) sclpos = this.dgRecentActivity.maxVerticalScrollPosition;
			this.dgRecentActivity.verticalScrollPosition = sclpos;
		}
	}catch(err:Error){
		Logger.LogE(err);
	}
}